cmake_minimum_required(VERSION 3.0.0)

project(profinet_com VERSION 0.1 LANGUAGES CXX)

message("[INFO] Configuring ${PROJECT_NAME}.")

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# SET(PLATFORM_SPECIFIC_LIBS "-lpthread")

set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set(CMAKE_AUTOMOC ON)

# Libray ExtensionSystem.
include_directories("p-net/include")

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    # 64-Bit system.
    link_directories("p-net/x64")
else()
    # 32-Bit system.
    link_directories("p-net/x32")
endif()


# set(Qt5_DIR "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5/")
# set(Qt5Core_DIR "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Core/")
# set(Qt5Widgets_DIR "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Widgets/")
# set(Qt5SerialPort_DIR "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5SerialPort/")
# set(Qt5Sql_DIR "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/cmake/Qt5Sql/")
# set(Qt5_LIBRARY_DIRS "/usr/local/Qt5.9.6/5.9.6/gcc_64/lib/")

find_package(Qt5Core)

set(SRC_${PROJECT_NAME}
    main.cpp
    profinet/initialization.cpp
    profinet/profinet_device.cpp
    test/test.cpp
)

add_executable(${PROJECT_NAME} ${SRC_${PROJECT_NAME}})
target_link_libraries(${PROJECT_NAME} Qt5::Core)
# target_link_libraries(${PROJECT_NAME} rt)
target_link_libraries(${PROJECT_NAME} profinet)
